/*
* @Author: Srain
* @Date:   2018-07-26 21:17:12
* @Last Modified by:   Srain 
* @Last Modified time: 2018-11-14 16:34:23
*/


'use strict';
require('./index.css');
require('page/common/nav/index.js');

var navSide         = require('page/common/nav-side/index.js');
var _mm             = require('util/mm.js');
var _score          = require('service/score-service.js');
var templateIndex   = require('./index.string');

// page 逻辑部分
var page = {
    init: function(){
        this.onLoad();
    },
    onLoad : function(){
        // 初始化左侧菜单
        navSide.init({
            name: 'user-score'
        });
        // 加载评分信息
        this.loadList();
    },
    // 加载评分信息
    loadList : function(){
        var _this       = this,
            listHtml    = '',
            $panelBody   = $('.panel-body');
        $panelBody.html('<div class="loading"></div>');

        //加载评分list
        _score.getScoreInfo(function(res){
            listHtml = _mm.renderHtml(templateIndex,{
                list : res
            });
           $panelBody.html(listHtml);
        }, function(errMsg){
            _mm.errorTips(errMsg);
        });
    }
};
$(function(){
    page.init();
});